<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="format-detection" content="telephone=no">
<link href="<?php echo TEMPLATE_SITE_URL;?>/css/common.css" type="text/css" rel="stylesheet">
<link href="<?php echo TEMPLATE_SITE_URL;?>/css/sale.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/zepto.js" charset="utf-8"></script>
<title>我的已卖拍品</title>
</head>
<body>
<div id="contentbox">
  <div class="topMenu">
    <div class="buyAndSell"> 
      <a href="index.php?act=my&op=userorder&userid=<?php echo intval($_GET['userid']);?>" class="buy">买买买</a>
      <div class="sell now">卖卖卖</div>
    </div>
    <ul>
      <li <?php if($_GET['state']==''){ echo 'class="selected"';}?> onclick="javascript:location.href='index.php?act=my&op=sellerorder';">全　部</li>
      <li <?php if($_GET['state']=='0'){ echo 'class="selected"'; }?> onclick="javascript:location.href='index.php?act=my&op=sellerorder&state=0';">待付款</li>
      <li <?php if($_GET['state']=='1'){ echo 'class="selected"'; }?> onclick="javascript:location.href='index.php?act=my&op=sellerorder&state=1';">未发货</li>
      <li <?php if($_GET['state']=='2'){ echo 'class="selected"'; }?> onclick="javascript:location.href='index.php?act=my&op=sellerorder&state=2';">待收货</li>
      <li onclick="javascript:location.href='index.php?act=my&op=sellerorderliupai'">流拍</li>
    </ul>
    <div class="search" onclick="javascript:location.href='index.php?act=my&op=search&type=2'"></div> 
  </div>
  <div class="orderMain"></div>
</div>

<input type="hidden" name="haspage" value="1" id="haspage">
<input type="hidden" name="pagenum" value="0" id="pagenum">
<div class="loadNextPage" style="margin-top:10px;color:#777;text-align:center;font-size:13px;display:none;">
	<div class="loading" style="width:100px;height:40px;margin-left:auto;margin-right:auto">
		<img src="<?php echo TEMPLATE_SITE_URL;?>/images/loadingData.gif" style="float:left">
		<span style="float:left;margin-top:10px;">加载拍卖</span>
	</div>
</div>

<script type="text/javascript">
$(function(){


	
    $(window).scroll(function () {
        var $body = $("body");
        if (($(window).height() + $(window).scrollTop()) >= $body.height()) {
	        var haspage = parseInt($('#haspage').val());
	        if(haspage=='0'){
				return false;
			}
    		var pagenum = parseInt($('#pagenum').val());
    		var nextpage = eval(pagenum+1);
    				
    		ajaxdata(nextpage);
        }
    });


	function ajaxdata(nextpage){

		var state = '<?php echo $_GET['state']?>';
		var keyword = '<?php echo $_GET['keyword']?>';
		var year = '<?php echo $_GET['year']?>';
		var month = '<?php echo $_GET['month']?>';
		var day = '<?php echo $_GET['day']?>';
		
		$.ajax({
			type:'get',
			url:'index.php?act=my&op=sellerorderdata',
			data:{nextpage:nextpage,state:state,keyword:keyword,year:year,month:month,day:day},
			dataType:'html',
			success:function(html){
				$('.loadNextPage').hide();
				if(html==''){
					$('#haspage').val('0');
				}else{
					$('#pagenum').val(nextpage);
					$('.orderMain').append(html);
				}

				$('.mysendout').click(function(){
					var order_id = $(this).attr('order_id');		
					location.href = 'index.php?act=payment&op=sendout&order_id='+order_id;
				});

				$('.currentexchange').click(function(){
					var order_id = $(this).attr('order_id');
					if(confirm('确认当面交易？')){
						$.ajax({
							type:'get',
							url:'index.php?act=order&op=currentexchange',
							data:{order_id:order_id},
							dataType:'json',
							success:function(data){
								if(data.state=='1'){
									location.reload();
								}
								return false;
							}
						});
					}
				});

				$('.confirmtuikuan').click(function(){
					var order_id = $(this).attr('order_id');		
					location.href = 'index.php?act=payment&op=confirmtuikuan&order_id='+order_id;
				});
				
				$('.accept').click(function(){
					var auction_id =  $(this).attr('auction_id');	
					location.href = 'index.php?act=payment&op=accepttuikuan&auction_id='+auction_id;
				});

				$('.refuse').click(function(){	
					var order_id = $(this).attr('order_id');			
					location.href = 'index.php?act=payment&op=refuse&order_id='+order_id;					
				});															
			},
			beforeSend:function(){
				$('.loadNextPage').show();
			}
		});
	}

	ajaxdata(1);
	
});
</script>
<?php include template('home/nav');?>
</body>
</html>
